Skip to content

refactor: move array equality utils into @monkeytype/util (@fehmer) - #8595

Open
fehmer wants to merge 1 commit into
masterfrom
refactor/arrays-util
Open

fehmer wants to merge 1 commit into
masterfrom
refactor/arrays-util

Conversation

@fehmer

@fehmer fehmer commented Nov 18, 2026

Copy link
Copy Markdown
Member

Summary

Pure move of two array equality helpers from the frontend into the shared util package; all call sites re-imported. No logic change.

 packages/util/src/arrays.ts
- export function intersect
+ export function intersect
+ export function areUnsortedArraysEqual
+ export function areSortedArraysEqual   (keeps the `readonly T[]` signature)
 frontend/src/ts/utils/arrays.ts
- export function areUnsortedArraysEqual
- export function areSortedArraysEqual

Re-pointed imports (../utils/arrays → @monkeytype/util/arrays): config/metadata.tsx, ui/SlimSelect.tsx, modals/EditResultTagsModal.tsx, modals/CommandlineModal.tsx (merged with its existing intersect import), modals/MobileTestConfigModal.tsx, pages/settings/custom-setting/CustomPolyglot.tsx, pages/settings/custom-setting/CustomLayoutfluid.tsx, pages/test/TestConfig.tsx, controllers/challenge-controller.ts, plus the one Arrays.areSortedArraysEqual namespace call in controllers/theme-controller.ts.

Evidence

  • Before: the two helpers lived in frontend/src/ts/utils/arrays.ts, duplicated by consumers of the package (intersect already lives in @monkeytype/util/arrays).
    After: single home in the package; pnpm ts-check (8 workspaces), pnpm lint (15 tasks), pnpm build (8 tasks) and pnpm test (14 tasks, incl. frontend 1867 tests) all green.

Merge Danger

Door: two-way

Mechanical move with identical implementations; reverting the commit restores the previous layout.

Blast Radius: small

Frontend-only; @monkeytype/util is already a frontend dependency and the functions are byte-for-byte the same, so no behavior or bundle-graph change.

@monkeytypegeorge monkeytypegeorge added frontend User interface or web stuff packages Changes in local packages labels Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend User interface or web stuff packages Changes in local packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants